home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / utility / ffe101.zip / SOUND.SWG / 0007_D00.pas < prev    next >
Pascal/Delphi Source File  |  1996-09-04  |  9KB  |  223 lines

  1. --------S-D00------------------------------
  2.  
  3. This  document describes the D00 music  format (used by the AdLib player
  4. v4.01  coded  by  JCH/Vibrants) in more  detail  than  the docs of EdLib
  5. (therespective tracker, also coded by JCH) do.
  6.  
  7. CONTENTS
  8. ========
  9.  
  10.   1. The D00 header
  11.   2. The Instrument data
  12.   3. The SpFX data
  13.   4. The arrangement data
  14.   5. The pattern data
  15.   6. Some more infos
  16.   7. Closing words
  17.  
  18. 1. The D00 header
  19. =================
  20.  
  21.   A  description of the D00 header can be found in the player's docs. So
  22. I  won't  show  it again here. But  JCH  gives very cryptic names to the
  23. other file structures, so I'll call them differently:
  24.  
  25.   JCH's names         | My names
  26.  
  27.   TPoin tables        = Arrangment data
  28.   SeqPointer tables   = Sequence data
  29.   Instrument data     = Instrument data
  30.   DataInfo text       = Song description
  31.   Special tables      = SpFX data
  32.  
  33.   Also, I should mention that all the pointers to these tables are meant
  34. relative to the beginning of the D00 file.
  35.  
  36.  
  37. 2. The Instrument data
  38. ======================
  39.  
  40.   The  instrument  data simply consists of  all  instruments used in the
  41. song. Since the number of instruments is stored nowhere inside the file,
  42. loaders should the start offset of the next structure for determining if
  43. they have read enough data.
  44.  
  45.   The  data for each instrument consists of 16 bytes, which occur in the
  46. same order as the corresponding bytes in the EdLib Instrument table:
  47.  
  48.     xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
  49.     └────────────┘ └────────────┘ │  │  │  │  │  │
  50.      Carrier data  Modulator data │  │  │  │  └──┴Unused
  51.                                   │  │  │  └Hard restart SR value
  52.                                   │  │  └Hard restart timer
  53.                                   │  └Fine-tune
  54.                                   └AM/FM + Feedback
  55.  
  56.   For the exact meaning of these bytes, read the EdLib manual.
  57.  
  58.   Note  that  in the Carrier and Modulator  data  the ADSR parts are not
  59. stored  word-oriented, but byte-oriented. That means, they aren't stored
  60. as  a  word whose High byte is the AD  part and whose Low byte is the SR
  61. part  (although  the display in  EdLib creates that assumption). Instead
  62. they're  simply stored as two bytes of which the first one's the AD part
  63. and the second one's the SR part.
  64.  
  65.  
  66. 3. The SpFX data
  67. ================
  68.  
  69.   The  SpFX  data ist stored more or  less like the Instrument data, but
  70. one single table entry consists of only 8 bytes arranged like this:
  71.  
  72.     xxxx xx xx xx xx xxxx (note xx's are BYTES and xxxx's are WORDS!)
  73.     │    │  │  │  │  │
  74.     │    │  │  │  │  └Pointer to next SpFX entry
  75.     │    │  │  │  └Duration of SpFX entry in Frames
  76.     │    │  │  └Modulator Level add
  77.     │    │  └New Modulator level
  78.     │    └Note add value
  79.     └Instrument to use
  80.  
  81.   Again, to really understand the meaning of these parts, you should
  82. read the
  83. EdLib docs.
  84.  
  85.  
  86. 4. The Arrangement data
  87. =======================
  88.  
  89.   The  arrangement  data  determines which sequence  is  to be played on
  90. which channel at which moment and in which way, if you understand what I
  91. mean :)
  92.  
  93.   It consists of two parts: The Pointer part and the Data part (I simply
  94. call them that way now :). The Pointer part consists of 16 word pointers
  95. and  one  endmark (all endmarks are FFFFh,  by  the way). Only the first
  96. nine pointers are used at the moment: one for each one of the nine AdLib
  97. channels. Each one of these nine pointers points to the part of the Data
  98. part which belongs to its channel.
  99.  
  100.   The  Data  part  consists,  as  you'd  have  guessed  before,  of nine
  101. independent  arrangement  streams.  Each  one  of  tese  streams has the
  102. following format:
  103.  
  104.   First  comes  a  word  telling the  speed  of  that stream. Since this
  105. information  is  stored at the beginning  of EVERY stream, I assume that
  106. every  channel  may have its own  unique speed, and EdLib simply doesn't
  107. support this. After that, the real arrangement data is stored.
  108.  
  109.   This  data is organized like this: If a word below 8000h is read, it's
  110. the number of a sequence to be played. In that case, the saved transpose
  111. data is used.
  112.  
  113.   But  if  a  word  8XYYh is read, with  X  and  YY being any value, the
  114. transpose  data  is  updated  to  X  and  YY  (see  the  EdLib  docs for
  115. information on the meaning of X and YY). I have found out that the first
  116. arrangement  entry for an arrangement stream  that contains at least one
  117. sequence is always such a command to set the internal transpose data. So
  118. no default value is required to be loaded into the transpose data before
  119. playing. And looping the arrangement stream becomes easier.
  120.  
  121.   If  the word FFFFh is read, the  arrangement stream has arrived at its
  122. looping  point.  The  word  following the  FFFFh  is  an offset into the
  123. arrangement  stream  telling  at  which  position  the  stream should be
  124. restarted.
  125.  
  126.   If the word FFFEh is read, the arrangement stream has reached its end.
  127. Unlike  the  Loop command (FFFFh), the  stream mustn't get restarted but
  128. halted. Also, there is no word following the FFFEh command.
  129.  
  130.  
  131. 5. The Sequence data
  132. ====================
  133.  
  134. (I guess you have been waiting for this :)
  135.  
  136.   The  Sequence  data again consists of a  pointer part and a data part.
  137. But  this  time these two parts aren't  stored in different parts of the
  138. file,  the  data  part  is  stored  directly  after  the  pointer  part.
  139. Therefore,  a  reference  to  a specific  pattern  should  be  seen as a
  140. reference  to  a word counted from  the  beginning of the Sequence data.
  141. This  word  (e.g. the first word for  Pattern  0000h) then points to the
  142. offset  of  the actual sequence data inside  the file. I hope you got my
  143. point...
  144.  
  145.   Then, each sequence is stored as follows:
  146.  
  147.   Read  a  word. If it's high byte is  below 20h, then it's a note. Note
  148. that  RESTs  and HOLDs are also counted  as notes. In this case, the low
  149. byte can contain the following values:
  150.  
  151.   00h = REST - The high byte tells the number of rests to insert minus
  152. one!
  153.         e.g. a REST with a high byte of 01h means "Two RESTs"
  154.  
  155.   01h - 7Dh = Note - The value of this note byte tells the amount of
  156.               halfnotes to add to C-0 (e.g. 01h would mean C#0). In
  157.               this case,the high byte tells the number of HOLDs to insert
  158.               after the note.
  159.  
  160.   7Fh = HOLD - The high byte tells the number of HOLDs minus one again!
  161.  
  162.   If  the  high byte is 20h or above,  but below 40h, it's a note again,
  163. but  this  time  with  Tienote switched on.  The  high  word  is used as
  164. repetition  count  again,  but  don't  forget  to  substract  20h before
  165. evaluating it!!
  166.  
  167.   If  the  high bzte is 40h or above,  it's an effect. In this case, the
  168. complete  word  can  simply be interpreted  like  any  EdLib effect (set
  169. instrument, set volume etc.). See the EdLib docs for a list of them. The
  170. note word this effect refers to follows directly after the ceffect word.
  171.  
  172.   If  the read word is FFFFh, it  indicates the end of that sequence. In
  173. that  case,  the  next sequence to  be  played  should be determined and
  174. loaded and the first effect/note of it should be played.
  175.  
  176.  
  177. 6. Some more infos
  178. ==================
  179.  
  180.   The  Song description (which is referred  to as "DataInfo" by JCH) can
  181. contain simply any kind of data, but it's mostly used as a container for
  182. a  descriptive text. This data is also terminated by an endmark (FFFFh),
  183. even if it contains no other data.
  184.  
  185.  
  186. 7. Closing words
  187. ================
  188.  
  189.   Okay, this was it. Now you should know as much about the D00 format as
  190. I  know. I hope that you understood my way of describing things and wish
  191. you best luck with your own tracker/player, maybe both...
  192.  
  193.   I  hope  that someone finds this  text  interesting and useful for his
  194. purposes.  I will most probably base my  own tracker format (if I code a
  195. tracker  some day :) on a mixture of  D00 and TFMX (which is pretty much
  196. the  same),  maybe with some bits of  XM... In my opinion JCH's sequence
  197. system  is  far  superior to all  of  the other pattern-oriented tracker
  198. formats  I  know.  Even XM can't compete  with  this  system in terms of
  199. pattern size. I hope that someone will introduce a sequence-based sample
  200. tracker system some day (Hope JCH is reading
  201. this... ;).
  202.  
  203.   Greetings go to:
  204.  
  205.   -Christoph Brzozowski - Greatest Amiga warrior around
  206.  
  207.   -Akintunde Omitowoju - Pushed me to make this description
  208.  
  209.   -Jens Christian Huus alias JCH/Vibrants - Maker of EdLib
  210.  
  211.   -Chris Hülsbeck - Maker of SidPlay on the C64 and TFMX on the Amiga
  212.  
  213.  
  214.   If you wanna contact me, send me an E-Mail:
  215.  
  216.   *** j.fenkes@public.ndh.com ***
  217.  
  218. Sayonara,
  219.   Joachim Fenkes
  220.  
  221.  
  222.  
  223.